/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package javax.servlet;

import java.util.Set;

/**
 * ServletContainerInitializers (SCIs) are registered via an entry in the
 * file META-INF/services/javax.servlet.ServletContainerInitializer that must be
 * included in the JAR file that contains the SCI implementation.
 * <p>
 * SCI processing is performed regardless of the setting of metadata-complete.
 * SCI processing can be controlled per JAR file via fragment ordering. If
 * absolute ordering is defined, then only the JARs included in the ordering
 * will be processed for SCIs. To disable SCI processing completely, an empty
 * absolute ordering may be defined.
 * <p>
 * SCIs register an interest in annotations (class, method or field) and/or
 * types via the {@link javax.servlet.annotation.HandlesTypes} annotation which
 * is added to the class.
 *
 * @since Servlet 3.0
 */
// ServletContainerInitializers (SCIs)是通过文件META-INF/services/javax.servlet中的一个条目注册的。
// 必须包含在包含SCI实现的JAR文件中的ServletContainerInitializer。
// 无论元数据完成的设置如何，都将执行SCI处理。
// SCI处理可以通过分段排序控制每个JAR文件。
// 如果定义了绝对排序，那么只有排序中包含的jar才会为sci进行处理。
// 为了完全禁用SCI处理，可以定义一个空的绝对排序。
// sci通过添加到类中的javax.servlet.annotation. handlesttypes注释注册注释(类、方法或字段)和/或类型的兴趣。
public interface ServletContainerInitializer {

    /**
     * Receives notification during startup of a web application of the classes
     * within the web application that matched the criteria defined via the
     * {@link javax.servlet.annotation.HandlesTypes} annotation.
     *
     * @param c     The (possibly null) set of classes that met the specified
     *              criteria
     * @param ctx   The ServletContext of the web application in which the
     *              classes were discovered
     *
     * @throws ServletException If an error occurs
     */
    // 在web应用程序启动期间，接收web应用程序中与通过javax.servlet.annotation. handlesttypes注释定义的标准相匹配的类的通知。
    // 参数: c -满足指定标准的类的集合(可能为空)
    // ctx—发现类的web应用程序的ServletContext
    // 抛出: ServletException -如果发生错误
    void onStartup(Set<Class<?>> c, ServletContext ctx) throws ServletException;
}
